<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 模拟块级作用域
        function outputNumbers(count) {
            (function () {
                for (var i = 0; i < count; i++) {
                    alert(i);
                }
            })()
            alert(i); //导致一个错误！
        }
        outputNumbers(3)
    </script>
</body>

</html>